import sa from'sa-sdk-javascript';

(function() {
    const buryPoint = {};
    buryPoint.install = (Vue, options = {}) => {
        Vue.directive('buryPoint', {
            inserted(el, binding) {
                el.addEventListener('click', e => {
                    sa.track('btn_click',{
                        name: el.lastChild.innerHTML
                    })
                    console.log(binding.value)
                });
                
            }
        });
    };
    if (typeof exports == 'object') {
        module.exports = buryPoint
    } else if (typeof define == 'function' && define.amd) {
        define([], () => buryPoint)
    } else if (window.Vue) {
        window.buryPoint = buryPoint;
        Vue.use(buryPoint)
    }
}());